package org.gxuwz.core.action;

import java.util.List;

import org.gxuwz.core.entity.TCommissure;
import org.gxuwz.core.service.ICommissureService;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class CommissureAction extends ActionSupport implements ModelDriven<TCommissure>{
	TCommissure comm = new TCommissure();
    List<TCommissure> list;
	String comcode;
	String perscode;
	String A;
	public String getA() {
		return A;
	}


	public void setA(String a) {
		A = a;
	}

	@Autowired
    ICommissureService commService;
	@Override
	public TCommissure getModel() {
		// TODO Auto-generated method stub
		return comm;
	}

	public String list() {
		list = commService.getAll(comcode, perscode);
		return "list";
	}
	
	public String jump(){
		comm = commService.getcommByPersCode(perscode);
		return "add";
	}
	
	public String results(){
		comm = commService.getcommByPersCode(perscode);
		System.out.println("ssssssddddddd"+comm.toString());
		return "comm";
	}
	
	public String sava(){
		commService.addCommissureDao(comm);
		return this.list();
	}
	public String getByPersCode(){
		comm = commService.getByPersCode(perscode);
		return "list";
	}
	public String edit(){
		comm = commService.getByPersCode(A);
		return "edit";
	}
	public String update(){
		commService.update(comm);
		return list();
	}
	public String delete(){
		comm = commService.getByPersCode(perscode);
		commService.delete(comm);
		return this.list();
	}

	//get set
	public TCommissure getComm() {
		return comm;
	}

	public void setComm(TCommissure comm) {
		this.comm = comm;
	}

	public List<TCommissure> getList() {
		return list;
	}

	public void setList(List<TCommissure> list) {
		this.list = list;
	}

	public String getComcode() {
		return comcode;
	}

	public void setComcode(String comcode) {
		this.comcode = comcode;
	}

	public String getPerscode() {
		return perscode;
	}

	public void setPerscode(String perscode) {
		this.perscode = perscode;
	}

	public ICommissureService getCommService() {
		return commService;
	}

	public void setCommService(ICommissureService commService) {
		this.commService = commService;
	}
	
	
}
